import time

from selenium.webdriver.common.by import By
from Base import Base

class Page(Base):

    # 定位元素
    username_loc = (By.XPATH,'/html/body/div[1]/div/section/section/main/div[1]/div[2]/div[1]/div/input')
    def username1(self,username):
        self.send_keys(self.username_loc,username)
    def username(self):
        self.send_keys(self.username_loc,'xiaokai')

    password_loc = (By.XPATH,'/html/body/div[1]/div/section/section/main/div[1]/div[2]/div[2]/div/input')
    def password(self):
        self.send_keys(self.password_loc,'123456')

    def password1(self,password):
        self.send_keys(self.password_loc, password)
    login_loc = (By.XPATH,'/html/body/div[1]/div/section/section/main/div[1]/div[2]/button[2]')
    def login(self):
        self.click(self.login_loc)

    sure_loc = (By.XPATH,'/html/body/div[1]/div/section/section/main/div[2]/div/div/div/div[2]/button[2]')
    def sure(self):
        self.click(self.sure_loc)


    def test_yw_01(self):
        # 获取网址
        self.open_url('http://localhost:8081/xklogin')
        self.username()
        time.sleep(3)
        self.password()
        time.sleep(3)
        self.login()
        time.sleep(3)
        self.sure()
        time.sleep(5)






















